#ifndef TID_H
#define TID_H
#include <string>
#include <algorithm>
#include <vector>
#include "ident.h"
using namespace std;
class TID
{
  vector<ident> m_stack;
public:
  TID();
  int push(const ident &p) {
    vector<ident>::iterator it;
    if ((it = find(m_stack.begin(), m_stack.end(), p)) != m_stack.end()) {
        return (int)distance(m_stack.begin(), it);
      }
    m_stack.push_back(p);
    return (int)m_stack.size() - 1;
  }
  ident & operator [] (int k) {
    if (k <  0 && k > (int)m_stack.size()) {
        throw "INDEX ASSERTION FAILED";
      }
    return m_stack[k];
  }

};

#endif // TID_H
